package com.ean.backpack.domain;

import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.format.annotation.DateTimeFormat;

@Entity
@Table(name = "propertytypelist")
public class Propertytypelist implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1457389077936370858L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "PropertyCategory")
	private Integer propertyCategory;

	public Integer getPropertyCategory() {
		return this.propertyCategory;
	}

	public void setPropertyCategory(Integer id) {
		this.propertyCategory = id;
	}

	@Column(name = "LanguageCode", length = 5)
	private String languageCode;

	@Column(name = "PropertyCategoryDesc", length = 256)
	private String propertyCategoryDesc;

	@Column(name = "TimeStamp")
	@NotNull
	@Temporal(TemporalType.TIMESTAMP)
	@DateTimeFormat(style = "MM")
	private Calendar timeStamp;

	public String getLanguageCode() {
		return languageCode;
	}

	public void setLanguageCode(String languageCode) {
		this.languageCode = languageCode;
	}

	public String getPropertyCategoryDesc() {
		return propertyCategoryDesc;
	}

	public void setPropertyCategoryDesc(String propertyCategoryDesc) {
		this.propertyCategoryDesc = propertyCategoryDesc;
	}

	public Calendar getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(Calendar timeStamp) {
		this.timeStamp = timeStamp;
	}

	@Override
	public String toString() {
		return ReflectionToStringBuilder.toString(this,
				ToStringStyle.SHORT_PREFIX_STYLE);
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((languageCode == null) ? 0 : languageCode.hashCode());
		result = prime
				* result
				+ ((propertyCategory == null) ? 0 : propertyCategory.hashCode());
		result = prime
				* result
				+ ((propertyCategoryDesc == null) ? 0 : propertyCategoryDesc
						.hashCode());
		result = prime * result
				+ ((timeStamp == null) ? 0 : timeStamp.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Propertytypelist other = (Propertytypelist) obj;
		if (languageCode == null) {
			if (other.languageCode != null)
				return false;
		} else if (!languageCode.equals(other.languageCode))
			return false;
		if (propertyCategory == null) {
			if (other.propertyCategory != null)
				return false;
		} else if (!propertyCategory.equals(other.propertyCategory))
			return false;
		if (propertyCategoryDesc == null) {
			if (other.propertyCategoryDesc != null)
				return false;
		} else if (!propertyCategoryDesc.equals(other.propertyCategoryDesc))
			return false;
		if (timeStamp == null) {
			if (other.timeStamp != null)
				return false;
		} else if (!timeStamp.equals(other.timeStamp))
			return false;
		return true;
	}

}
